<head><%= stylesheet_link_tag 'teststylesheet' %></head>

<%= render :active_scaffold => 'teams', :constraints => {:project_id => @project.id} -%>


<script>

<% if !@project.is_logged_in_project_administrator? %>
	<% @project.teams.each do |team| %>
		document.getElementById('teams-destroy-<%= team.id.to_s %>-link').innerHTML = '';
	<% end -%>
<% else -%>
document.getElementById('mod_actions').innerHTML = '<a href="/teams/new/<%= @project.id.to_s %>"  class="new action" id="teams-new--link" position="top">Add a new team!</a>' + document.getElementById('mod_actions').innerHTML;
<% end -%>
</script>

<br />
<hr>
<br />

<H1 align="left"><a href="<%= @host %>/projects">Projects</a> >> <a href="<%= @host %>/projects/<%= @project.id %>"><%= @project.name %></a> >> Teams</H1>
<H2 class="link_bar" align="right"><img src="/images/magnifier.png" align="absmiddle"><%=link_to 'Search' %><img src ="/images/add.gif" align="absmiddle"><a href="<% @host %>/teams/new/<%= @project.id %>">Add a new team!</a></H2>
<table cellpadding="0" cellspacing="0">

 <thead>
  <TR>
   <TH scope="col">Manager</TH>
   <TH scope="col">Team Members</TH>
   <TH scope="col">Projections</TH>
   <TH scope="col"></TH>
  </TR>
 </thead>

  <tbody>
  <% @odd = true %>
  <% @project.teams.each do |team| %>
    <% if @odd %>
      <tr class = "odd">
    <% else -%>
      <tr>
    <% end -%>
      <TD scope="row"><a href="<%= @host %>/teams/<%= team.id %>"><%= team.manager.name %></a></TD>
      <TD scope="row"><%= team.count %></TD>
      <% if @project.is_logged_in_project_administrator? %>
        <TD scope="row"><a href="<%= @host %>/projections/index_for_team/<%= team.id %>">View/Edit</a> </TD>
        <TD scope="row"><%= link_to 'Delete', :confirm => "Are you Sure?", :method => :delete %></TD>
      <% else -%>
        <TD scope="row"><%= link_to "View", show_team_path(team) %></TD>
        <TD scope="row"><TD>
      <% end -%>
     </TR>
     <% @odd = !@odd %>
   <% end %>
  </tbody>

<tfoot>
 <TR>
 <TD colspan="4" align="left"><%= @project.teams.count %> Found</TD>
 </TR>
 <tfoot>
</table>
